<!-- inc:frame.top -->

<!-- if($sysAct == "add" || $sysAct == "modify") -->
<!-- run:$button_msg = $sysAct == "modify" ? "编辑管理员" : "添加管理员" -->
<div class="position"><p><!-- inc:position --> &raquo; <a href="{:$mainlink}?file=adminer&act=list">用户管理</a> &raquo; <a href="{:$mainlink}?file=adminer&act=list">管理员列表</a> &raquo; {:$button_msg}</p><!-- inc:position.fr --></div>

<div class="page_pad">
  <form name="qgform" id="qgform" method="post" action="{if($sysAct=='modify')}{:$mainlink}?file=adminer&act=modifyok&id={:$id}{else}{:$mainlink}?file=adminer&act=addok{end}" onsubmit="return add_msg(this);">
  <div class="content_box">
    <div class="content_bor">
      <table class="ctable">
        <tr>
          <td class="left">账号：<span style="color:red;">*</span></td>
          <td class="right"><input class="ginput" type="text" name="username" id="username" value="{:$rs[user]}" /></td>
        </tr>
        <tr>
          <td class="left">密码：<span style="color:red;">*</span></td>
          <td class="right">
            <table class="ntable">
              <tr>
                <td><input class="ginput" type="text" name="password" id="password" value="{:$rs[pass]}" /></td>
                <td>&nbsp;&nbsp;</td>
                <td><button class="gbutton" type="button" onclick="randpass('password',8)">生成随机密码</button></td>
                <td>&nbsp;&nbsp;</td>
                <td>
                  <!-- if($sysAct == "modify") -->
                  <span>[不修改密码请不要改动内容,密码必须由数字、字母、特殊字符组成且大于7位数]</span>
                  <!-- else -->
                  <span>[密码必须由数字、字母、特殊字符组成且大于7位数]</span>
                  <!-- end -->
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr style="display:none;">
          <td class="left">管理员邮箱：</td>
          <td class="right"><input class="ginput" type="text" name="email" id="email" value="{:$rs[email]}" /></td>
        </tr>
        <tr>
          <td class="left">管理员类型：</td>
          <td class="right">
            <table class="ntable">
              <tr>
                <!-- if($_SESSION[admin][typer] == "system") -->
                <td><input type="radio" name="typer" value="system"{if($rs[typer]=="system")} checked{end}></td>
                <td>系统管理员&nbsp;&nbsp;</td>
                <td><input type="radio" name="typer" value="manager"{if($rs[typer]=="manager")} checked{end}></td>
                <td>管理员&nbsp;&nbsp;</td>
                <!-- end -->
                <td><input type="radio" name="typer" value="editor"{if($rs[typer]!='manager' && $rs[typer]!='system')} checked{end}></td>
                <td>工作人员&nbsp;&nbsp;</td>
                <td>[工作人员需要针对以下模块权限进行设置]</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td class="left">常用的模块权限：</td>
          <td class="right">
            <table class="ntable">
              <tr>
                <!-- if($QG_AP[keywords]) -->
                <td><input type="checkbox" name="modulelist[]" value="keywords"{if($module[keywords])} checked{end}></td>
                <td>关键词修改&nbsp;&nbsp;</td>
                <!-- end -->
                <!-- if($QG_AP[book_feedback]) -->
                <td><input type="checkbox" name="modulelist[]" value="book_feedback"{if($module[book_feedback])} checked{end}></td>
                <td>留言反馈&nbsp;&nbsp;</td>
                <!-- end -->
                <!-- if($QG_AP[online]) -->
                <td><input type="checkbox" name="modulelist[]" value="online"{if($module[online])} checked{end}></td>
                <td>客服代码&nbsp;&nbsp;</td>
                <!-- end -->
                <!-- if($QG_AP[user]) -->
                <td><input type="checkbox" name="modulelist[]" value="user"{if($module[user])} checked{end}></td>
                <td>会员档案&nbsp;&nbsp;</td>
                <!-- end -->
              </tr>
              <tr>
                <!-- if($QG_AP[orderlist]) -->
                <td><input type="checkbox" name="modulelist[]" value="orderlist"{if($module[orderlist])} checked{end}></td>
                <td>订单管理&nbsp;&nbsp;</td>
                <!-- end -->
                <!-- if($QG_AP[link]) -->
                <td><input type="checkbox" name="modulelist[]" value="link"{if($module[link])} checked{end}></td>
                <td>友情链接&nbsp;&nbsp;</td>
                <!-- end -->
                <!-- if($QG_AP[vote]) -->
                <td><input type="checkbox" name="modulelist[]" value="vote"{if($module[vote])} checked{end}></td>
                <td>投票管理&nbsp;&nbsp;</td>
                <!-- end -->
                <!-- if($QG_AP[job]) -->
                <td><input type="checkbox" name="modulelist[]" value="job"{if($module[job])} checked{end}></td>
                <td>招聘应聘&nbsp;&nbsp;</td>
                <!-- end -->
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td class="left">内容模块权限：</td>
          <td class="right">
            <table id="qxcontent" class="ntable">
              <tr>
                <!-- $modlist AS $key=>$value -->
                <td><input type="checkbox" name="modulelist[]" value="msg_{:$value[id]}"{if(strpos(",".$rs[modulelist].",",",msg_".$value[id].",") !== false)} checked{end}></td>
                <td>{:$value[groupname]}&nbsp;&nbsp;</td>
                <!-- end -->
                <td><a href="javascript:void(0)" onclick="select_all('qxcontent')">&nbsp;&nbsp;全选</a></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </div>
  </div><!--content_box-->
  
  <div class="gbutton_div"><button type="submit" class="gbutton gbutton_dblue gbutton_add" id="creat_button">{:$button_msg}</button> &nbsp; <button type="button" class="gbutton gbutton_add" onclick="qgurl('{:$mainlink}?file=adminer&act=list')">返回</button> &nbsp; <span id="show_step" style="color:red;"><img src="images/loading.gif" style="visibility:hidden;" /></span></div>
  </form>
</div><!--page_pad-->

<script type="text/javascript">
function add_msg(o)
{
	if(!o.username.value)
	{
		tip_msg("管理员名称不允许为空");
		return false;
	}

	document.getElementById("show_step").innerHTML = "<img src='images/loading.gif' border='0' align='absmiddle'> 正在保存数据，如果网页没有动静请刷新...";
	document.getElementById("creat_button").disabled=true;
}
</script>

<!-- elseif($sysAct == "list") -->
<div class="position"><p><!-- inc:position --> &raquo; <a href="{:$mainlink}?file=adminer&act=list">用户管理</a> &raquo; 管理员列表</p><!-- inc:position.fr --></div>

<div class="page_pad">
  <div class="content_add"><button class="gbutton gbutton_dblue gbutton_add" type="button" onclick="qgurl('{:$mainlink}?file=adminer&act=add')">添加管理员</button></div>
  
  <div class="content_box">
    <div class="content_bor">
      <table class="ltable">
        <tr class="first">
          <td align="left">管理员账号</td>
          <td width="220">操作</td>
        </tr>
        <!-- if($_SESSION[admin][typer] == "system") -->
        <!-- $rslist2 AS $key=>$value -->
        <tr>
          <td align="left">{:$value[user]}</td>
          <td><button class="gbutton" type="button" onclick="qg_modify('{:$value[id]}')">编辑</button> &nbsp; <button class="gbutton" type="button" onclick="qg_delete('{:$value[id]}')">删除</button></td>
        </tr>
        <!-- end -->
        <!-- end -->
        
        <!-- if($_SESSION[admin][typer] == "manager") -->
        <!-- $rslist AS $key=>$value -->
        <tr>
          <td align="left">{:$value[user]}</td>
          <td><button class="gbutton" type="button" onclick="qg_modify('{:$value[id]}')">编辑</button> &nbsp; <button class="gbutton" type="button" onclick="qg_delete('{:$value[id]}')">删除</button></td>
        </tr>
        <!-- end -->
        <!-- end -->
      </table>
    </div>
  </div><!--content_box-->
</div><!--page_pad-->

<script type="text/javascript">
function qg_modify(id)
{
	qgurl("{:$mainlink}?file=adminer&act=modify&id="+id);
}
function qg_delete(id)
{
	//判断是否删除
	url = "{:$mainlink}?file=adminer&act=delete&id="+id;
	tip_confirm("确认删除该信息吗？特别说明，删除后无法恢复！",url);
}
</script>
<!-- end -->

<!-- inc:frame.bottom -->